import settings
from google.appengine.ext import webapp
from google.appengine.ext.webapp import util
from models import *
import os
from google.appengine.ext.webapp import template

class TooltipHandler(webapp.RequestHandler):

    def get(self):
        id = self.request.GET['ticket']
        ticket = Ticket.gql('WHERE id = :1', id).get()
        path = os.path.join(os.path.dirname(__file__), '../templates/ticket_tooltip.html')
        self.response.out.write(template.render(path, {
            'ticket': ticket,
        }))


def main():
    application = webapp.WSGIApplication([('/tickets/tooltip/', TooltipHandler)], 
        debug=True)
    util.run_wsgi_app(application)

if __name__ == '__main__':
    main()
